Skip to content

Redirect fot WARNING_CONTINUE_CVV#47

Merged
lukasz-falda merged 1 commit into
mainfrom
redirect-for-warning-continue-cvv
May 27, 2026
Merged

Redirect fot WARNING_CONTINUE_CVV#47
lukasz-falda merged 1 commit into
mainfrom
redirect-for-warning-continue-cvv

Conversation

@lukasz-falda

Copy link
Copy Markdown
Member

AC

  • handle redirect for WARNING_CONTINUE_CVV

Comment thread src/Action/CaptureAction.php Outdated
};
}

if (StatusCode::WarningContinueCVV === $orderCreatedResponse->status->statusCode) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's getting a lot of ifs here
perhaps it's time to refactor it into some strategies?
Or match statements with private methods at least?
@whatever

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, I've changed it to match syntax. That makes it easier to see what's going on here.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the PayU CaptureAction flow to treat WARNING_CONTINUE_CVV as a redirectable “continue” status (similar to existing 3DS handling), and extends the integration test suite to cover these redirect scenarios.

Changes:

  • Refactor redirect selection in CaptureAction::execute() using a single match to handle SUCCESS, WARNING_CONTINUE_3DS (iframe vs non-iframe), and WARNING_CONTINUE_CVV.
  • Add integration tests for WARNING_CONTINUE_3DS (with a data provider for iframe allowed/not allowed) and for WARNING_CONTINUE_CVV.
  • Adjust test gateway mocking to set payment details as an ArrayObject.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Action/CaptureAction.php Adds redirect handling for WARNING_CONTINUE_CVV and consolidates redirect logic for success/3DS/CVV responses.
tests/Integration/Action/CaptureActionTest.php Adds test coverage for 3DS redirect variants and CVV continue redirect behavior.
Comments suppressed due to low confidence (1)

src/Action/CaptureAction.php:60

  • The docblock says @throws HttpRedirect|IframeHttpRedirect|PayUException, but execute() can also throw other exceptions from this method body (e.g., LogicException when orderId is present, InvalidArgumentException from recurring token checks). Either broaden the @throws list or remove it to avoid misleading API documentation.
    /**
     * @param Capture $request
     *
     * @throws HttpRedirect|IframeHttpRedirect|PayUException
     */
    public function execute($request): void
    {
        RequestNotSupportedException::assertSupports($this, $request);

        $firstModel = PaymentHelper::ensurePayment($request->getFirstModel());
        $token = $request->getToken();

        $this->convertAction($firstModel, $token);
        $model = Model::ensureArrayObject($firstModel->getDetails());
        if (!empty($model->orderId())) {
            throw new \LogicException('Capture payment with order id present is forbidden.');

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Action/CaptureAction.php
@lukasz-falda lukasz-falda merged commit d129822 into main May 27, 2026
4 checks passed
@lukasz-falda lukasz-falda deleted the redirect-for-warning-continue-cvv branch May 27, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants